//
//  NYGoodSubjectAnalysisView.m
//  NiuWaJiaoYu
//
//  Created by MinLison on 2018/1/5.
//  Copyright © 2018年 niuwaketang. All rights reserved.
//

#import "NYSubjectAnalysisView.h"

@interface NYSubjectAnalysisView ()
@property(nonatomic, strong) DTAttributedTextView *textView;
@property(nonatomic, strong) NYHtmlHelper *htmlHelper;
@end
@implementation NYSubjectAnalysisView
- (void)setupView
{
        [super setupView];
        [self addSubview:self.textView];
        [self.textView mas_remakeConstraints:^(MASConstraintMaker *make) {
                
                if (@available(iOS 11.0,*))
                {
                        make.bottom.equalTo(self.mas_safeAreaLayoutGuideBottom);
                        make.top.equalTo(self.mas_safeAreaLayoutGuideTop);
                        make.left.equalTo(self.mas_safeAreaLayoutGuideLeft);
                        make.right.equalTo(self.mas_safeAreaLayoutGuideRight);
                }
                else
                {
                        make.bottom.equalTo(self.controller.mas_bottomLayoutGuideTop);
                        make.top.equalTo(self.controller.mas_topLayoutGuideBottom);
                        make.left.right.equalTo(self);
                }
        }];
}
- (void)setHtmlString:(NSString *)htmlString
{
        _htmlString = htmlString;
        self.textView.attributedString = [self.htmlHelper attributedStringForHtmlString:self.htmlString maxImageSize:CGSizeMake(__WGWidth(self.width), CGFLOAT_MAX) imgSizeCallBackBlock:^(CGSize imgSize) {
                
        }];
}
- (NYHtmlHelper *)htmlHelper
{
        if (_htmlHelper == nil) {
                _htmlHelper = [[NYHtmlHelper alloc] init];
        }
        return _htmlHelper;
}
- (DTAttributedTextView *)textView
{
        if (_textView == nil) {
                _textView = [[DTAttributedTextView alloc] init];
        }
        return _textView;
}
@end
